#pragma once

#include <vector>
using std::vector;

class CTile;
class CCamera;
class CBaseObject;
class CSGD_TextureManager;


class CLayer
{
public:
	CLayer(void);
	~CLayer(void);

	void RenderLayer( void );
	void UpdateLayer( float dCameraPosition );
	bool AddTile( CTile* pTile );
	bool CheckCharacterCollision( CBaseObject* pOther );

	// Returns a vector of CTile* that are withing 4 tiles of the
	// characters position
	vector< CTile* > GetSurroundingTiles( CBaseObject* pCharacter );

	// Returns positions relative to the camera
	int	 GetTileRelativeXPosition( CTile* pTile );
	int	 GetTileRelativeYPosition( CTile* pTile );

	/* Accessors */
	unsigned int		GetPaletWidth( void ) const		{	return m_unPaletWidth;		}
	unsigned int		GetPaletHeight( void ) const	{	return m_unPaletHeight;		}
	unsigned int		GetMapWidth( void ) const		{	return m_unMapWidth;		}
	unsigned int		GetMapHeight( void ) const		{	return m_unMapHeight;		}
	unsigned int		GetTileWidth( void ) const		{	return m_unTileWidth;		}
	unsigned int		GetTileHeight( void ) const		{	return m_unTileHeight;		}
	int					GetPaletID( void ) const		{	return m_nPaletID;			}
	float				GetScrollRate( void ) const		{	return m_fScrollRate;		}
	float				GetPaletScale( void ) const		{	return m_fPaletScale;		}
	int					GetLayerScrollPos( void ) const {	return m_nScrollPosition;	}

	/* Mutators */
	void				SetPaletWidth( int nWidth )		{	m_unPaletWidth = nWidth;	}
	void				SetPaletHeight( int	nHeight )	{	m_unPaletHeight = nHeight;	}
	void				SetMapWidth( int nWidth )		{	m_unMapWidth = nWidth;		}
	void				SetMapHeight( int nHeight)		{	m_unMapHeight = nHeight;	}
	void				SetTileWidth( int nWidth )		{	m_unTileWidth = nWidth;		}
	void				SetTileHeight( int nHeight )	{	m_unTileHeight = nHeight;	}
	void				SetPaletID( int nID )			{	m_nPaletID = nID;			}
	void				SetScrollRate( float fScroll)	{	m_fScrollRate = fScroll;	}
	void				SetPaletScale( float fScale )	{	m_fPaletScale = fScale;		}

private:
	vector< CTile* >	m_Tiles;
	int					m_nPaletID;
	unsigned int		m_unPaletWidth;
	unsigned int		m_unPaletHeight;
	float				m_fPaletScale;
	unsigned int		m_unTileHeight;
	unsigned int		m_unTileWidth;
	unsigned int		m_unMapHeight;
	unsigned int		m_unMapWidth;
	float				m_fScrollRate;
	int					m_nScrollPosition;

	bool				m_bWrap;
	bool				m_bTopLayer;

	CSGD_TextureManager*	m_pTM;
	CCamera*				m_pCamera;

};

